1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.42">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Helvetica
; min-height: 11.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco
; min-height: 16.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #a71e12}
17 span
.s1
{font: 18.0px Helvetica
}
18 span
.s2
{color: #0019b7}
19 span
.s3
{color: #a71e12}
20 span
.Apple-tab-span
{white-space:pre
}
24 <p class=
"p1"><span class=
"s1"><b>K2A
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>control rate to audio rate converter
</b></p>
25 <p class=
"p2"><br></p>
26 <p class=
"p2"><br></p>
27 <p class=
"p1"><b>K2A.ar(in)
</b></p>
28 <p class=
"p2"><br></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p1">To be able to play a control rate UGen into an audio rate UGen, sometimes the rate must be converted.
</p>
32 <p class=
"p1">K2A converts via linear interpolation.
</p>
33 <p class=
"p2"><br></p>
34 <p class=
"p1"><b>in
</b> - input signal
</p>
35 <p class=
"p3"><br></p>
36 <p class=
"p4"><br></p>
37 <p class=
"p4"><br></p>
38 <p class=
"p5">{
<span class=
"s2">K2A
</span>.ar(
<span class=
"s2">WhiteNoise
</span>.kr(
0.3)) }.scope;
</p>
39 <p class=
"p6"><br></p>
40 <p class=
"p6"><br></p>
41 <p class=
"p7">// compare:
</p>
42 <p class=
"p6"><br></p>
44 <p class=
"p5">{
<span class=
"Apple-converted-space"> </span></p>
45 <p class=
"p5"><span class=
"Apple-tab-span"> </span>[
</p>
46 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">K2A
</span>.ar(
<span class=
"s2">WhiteNoise
</span>.kr(
0.3)),
</p>
47 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">WhiteNoise
</span>.ar(
0.3)
</p>
48 <p class=
"p5"><span class=
"Apple-tab-span"> </span>]
</p>
49 <p class=
"p5">}.scope;
</p>
51 <p class=
"p6"><br></p>
52 <p class=
"p6"><br></p>
54 <p class=
"p5">{
<span class=
"Apple-converted-space"> </span></p>
55 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> freq, blockSize, sampleRate;
</p>
56 <p class=
"p5"><span class=
"Apple-tab-span"> </span>blockSize =
<span class=
"s2">Server
</span>.internal.options.blockSize;
<span class=
"s3">// usually
64</span></p>
57 <p class=
"p5"><span class=
"Apple-tab-span"> </span>sampleRate =
<span class=
"s2">Server
</span>.internal.sampleRate;
</p>
58 <p class=
"p5"><span class=
"Apple-tab-span"> </span>freq =
<span class=
"s2">MouseX
</span>.kr(
0.1,
40,
1) / blockSize * sampleRate;
</p>
59 <p class=
"p5"><span class=
"Apple-tab-span"> </span>[
</p>
60 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">K2A
</span>.ar(
<span class=
"s2">LFNoise0
</span>.kr(freq)),
</p>
61 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">LFNoise0
</span>.ar(freq)
</p>
62 <p class=
"p5"><span class=
"Apple-tab-span"> </span>] *
0.3</p>
63 <p class=
"p5">}.scope;
</p>
65 <p class=
"p6"><br></p>
66 <p class=
"p6"><br></p>
67 <p class=
"p6"><br></p>
68 <p class=
"p6"><br></p>